package training;

import java.util.*;

/**
 * @Author liangzai
 * @Description:
 */
public class J25_6_8_Training {
    //N皇后
    public int[] COL;
    public int[] dig1;
    public int[] dig2;
    public List<List<String>> ret;
    public List<List<String>> solveNQueens(int n) {
        COL = new int[n];
        dig1 = new int[2*n-1];
        dig2 = new int[2*n-1];
        ret = new ArrayList<>();
        dfs(n,new ArrayList<String>());
        return ret;
    }

    public void dfs(int n,List<String> path){
        if(path.size()>=n){
            List<String> addpath= new ArrayList<>(path);
            ret.add(addpath);
            return ;
        }
        int row = path.size();
        for (int i = 0; i < n; i++) {
            if(COL[i] == 0 && dig1[row+i]==0 && dig2[row-i+n-1]==0){
                char[] ch = new char[n];
                Arrays.fill(ch,'.');
                ch[i] = 'Q';
                path.add(String.valueOf(ch));
                COL[i] = 1; dig1[row+i] = 1; dig2[row-i+n-1] = 1;
                dfs(n,path);
                COL[i] = 0; dig1[row+i] = 0; dig2[row-i+n-1] = 0;
                path.remove(path.size()-1);
            }
        }
    }

    //左移右移
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        Deque<Integer> deque = new LinkedList<>();
        List<Integer> list = new LinkedList<>();
        for(int i = 1; i <= n; i++) {
            list.add(i);
        }
        for(int i = 0 ;i < m; i++) {
            String ch = scanner.next();
            int val = scanner.nextInt();
            if(ch.equals("L")) {
                list.remove((Object)val);
                deque = new LinkedList<>(list);
                deque.addFirst(val);
                list = new LinkedList<>(deque);
            }else {
                list.remove((Object)val);
                deque = new LinkedList<>(list);
                deque.addLast(val);
                list = new LinkedList<>(deque);
            }
        }
        for(Integer x : list) {
            System.out.print(x+" ");
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int[][] nums = new int[n+1][2];
        for (int i = 1; i <= n; i++) {
            nums[i][0] = nums[i][1] = i;
        }
        int min = 1;
        int max = n;
        for (int i = 0; i < m; i++) {
            char ch = scanner.next().charAt(0);
            int val = scanner.nextInt();
            if(ch=='L') {
                nums[val][1] = --min;
            }else {
                nums[val][1] = ++max;
            }
        }
        Arrays.sort(nums,1,n+1,(a,b)->{
            return a[1] - b[1];
        });
        for (int i = 1; i <= n; i++) {
            System.out.print(nums[i][0]+" ");
        }
    }
}




